package it.uniroma2.art.coda.projectionrule.antlr;

import it.uniroma2.art.coda.core.CODACore;
import it.uniroma2.art.coda.exception.PRParserException;
import it.uniroma2.art.coda.projectionrule.ParserPR;
import it.uniroma2.art.coda.projectionrule.ProjectionRulesModel;

public class ValidateProjRuleFile {
	String prPath;
	
	public static void main(String[] args) {
		System.out.println("starting program");
		String prPath = "E:/CODATest/provaPRPrint.pr";
		ValidateProjRuleFile validateProjRule = new ValidateProjRuleFile(prPath);
		validateProjRule.validate();
		System.out.println("program ended");
	}
	
	ValidateProjRuleFile(String prPath){
		this.prPath = prPath;
	}
	
	void validate(){
		ProjectionRulesModel prModel = new ProjectionRulesModel();
		ParserPR antlrParser = new ANTLRParserPR("ANTLRParser", "this is an ANTRL Parser");
		try{
			CODACore codaCore = new CODACore();
			antlrParser.initialize(prModel, prPath, codaCore); // TODO check if by passing this parameter
			antlrParser.parsePR();
			System.out.println("parsing complete"); //
			//prModel.printModel();
		}
		catch (PRParserException ex){
			String msg = ex.getMessage();
			System.out.println(msg);
		}
	}

}
